package net.lookyou.boot.demo.mapper;

import net.lookyou.boot.demo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select(value = "select * from t_user")
    List<User> queryUserList();

    @Select(value = "select * from t_user where id=#{id}")
    User queryUserById(@Param(value = "id") int id);

    @Insert(value = "insert into t_user(id,name) values('${user.id}','${user.name}')")
    int addUser(@Param(value = "user") User user);

}